home *** CD-ROM | disk | FTP | other *** search
Java Source | 2002-08-11 | 3.7 KB | 107 lines |
- /*
- * 01/09/2002 - 20:43:57
- *
- * Prefs.java -
- * Copyright (C) 2002 Csaba KertΘsz
- * kcsaba@jdictionary.info
- * www.jdictionary.info
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
- package info.jdictionary;
-
- import java.io.Serializable;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.util.ArrayList;
-
- public class Prefs implements Serializable {
-
- public Prefs() {}
-
-
- static Prefs loadPrefs(String path) {
- Prefs p;
- File f = new File(path);
- try {
- FileInputStream fin = new FileInputStream(f);
- ObjectInputStream oin = new ObjectInputStream(fin);
- p = (Prefs)oin.readObject();
- }
- catch (java.io.FileNotFoundException e) {
- p = new Prefs();
- }
- catch (java.io.StreamCorruptedException e) {
- System.out.println("loadPrefs: StreamCorrupted, loading defaults");
- p = new Prefs();
- }
- catch (java.io.IOException e) {
- System.out.println("loadPrefs: IOException, loading defaults");
- p = new Prefs();
- }
- catch (java.lang.ClassNotFoundException e) {
- System.out.println("loadPrefs: ClassNotFound, loading defaults");
- p = new Prefs();
- }
- catch (java.lang.Exception e) {
- System.out.println("loadPrefs: Error, loading defaults");
- p = new Prefs();
- }
- return p;
- }
-
-
- static void savePrefs(Prefs prefs, String path) {
- File f = new File(path);
- try {
- FileOutputStream fout = new FileOutputStream(f);
- ObjectOutputStream oout = new ObjectOutputStream(fout);
- oout.writeObject(prefs);
- }
- catch (java.io.FileNotFoundException e) {}
- catch (java.io.IOException e) {
- System.out.println("savePrefs: IOException, unable to save prefs");
- }
- }
-
-
- //fields to save (and their default values)
- public info.jdictionary.pluginstuff.PluginInfoSheet lastSelectedPlugin;
- public String lastSelectedSubPluginName;
- public int width = 765;
- public int height = 555;
- public int dividerLocation = 200;
- public ArrayList InActivePlugins = new ArrayList();
- public int lastCheckedNewsVersion = 0;
- public boolean CheckingForUpgrade = true;
- public boolean CheckingForNews = true;
- public boolean usingHttpProxy = false;
- public boolean usingSocksProxy = false;
- public boolean usingHttpProxyLogin = false;
- public boolean usingSocksProxyLogin = false;
- public String httpProxyServer = new String();
- public String httpProxyPort= new String();
- public String httpProxyLogin= new String();
- public char[] httpProxyPassword= new char[0];
- public String socksProxyServer= new String();
- public String socksProxyPort= new String();
- public String socksProxyLogin= new String();
- public char[] socksProxyPassword = new char[0];
- }